package com.lihao.baselibrary.utils;

import org.xutils.http.RequestParams;

/**
 * Created by lihao on 2018/1/9.
 */

public class UrlUtils {
    public static String getUrlParams(RequestParams rp){
        StringBuffer url = new StringBuffer();
        url.append(rp.getUri());
        for (int i = 0; i < rp.getStringParams().size(); i++) {
            if (i==0){
                url.append("?");
                url.append(rp.getStringParams().get(i).key+"=");
                url.append(rp.getStringParams().get(i).getValueStr());

            }else {
                url.append("&");
                url.append(rp.getStringParams().get(i).key+"=");
                url.append(rp.getStringParams().get(i).getValueStr());
            }
        }
        return url.toString();
    }
}
